<?php

namespace App\Model\Common;

use App\Core\BaseModel;
use App\Model\Member\MemberModel;
use EasySwoole\Component\Di;
use EasySwoole\Redis\Redis;

/**
 * CREATE TABLE `ss_upload` (
 * `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
 * `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户id',
 * `file_path` varchar(255) NOT NULL DEFAULT '' COMMENT '文件保存地址',
 * `org_name` varchar(32) NOT NULL COMMENT '原文件名',
 * `created_at` datetime NOT NULL DEFAULT '1970-01-01 08:00:00' COMMENT '创建时间',
 * `created_by` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人员账号',
 * `updated_at` datetime NOT NULL DEFAULT '1970-01-01 08:00:00' ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
 * `updated_by` varchar(32) NOT NULL DEFAULT '' COMMENT '最后更新人员账号',
 * `is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除[0:未删除，1：已删除]',
 * `deleted_at` datetime NOT NULL DEFAULT '1970-01-01 08:00:00' COMMENT '删除时间',
 * PRIMARY KEY (`id`) USING BTREE,
 * KEY `idx_user_id` (`user_id`)
 * ) ENGINE=InnoDB AUTO_INCREMENT=536 DEFAULT CHARSET=utf8mb4 COMMENT='订单修改记录表';
*/

/**
 * Class UserModel
 * @property int $id
 * @property int $user_id
 * @property string $file_path
 * @property string $org_name
 * @property string $created_at
 * */
class UploadModel extends BaseModel
{

    protected $tableName = 'ss_upload';

    protected $casts = [
        'id' => 'int',
        'user_id' => 'int',
        'created_at' => 'datetime',
        'file_path' => 'string',
        'org_name'=> 'string',
    ];


    protected static function onAfterUpdate($model, $res)
    {
        self::delCache('uploadCache:');
    }

    protected static function onAfterInsert($model, $res)
    {
        self::delCache('uploadCache:');
    }
}
